<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function answer() {
            //根据ID，得到指定id对应的元素对象
            var spanObj = document.getElementById("infoSpan");
            //设置标题中间的文本
            spanObj.innerHTML = "打瞌睡";
            //设置标签文本颜色
            spanObj.style.color = "red";
            //设置标签背景色
            spanObj.style.backgroundColor="yellow";
            //设置字体大小
            spanObj.style.fontSize="12px";
        }
    </script>
</head>
<body>
<input type="button" value="打什么不费力气" onclick="answer()">
<span id="infoSpan"></span>
</body>
</html>